package com.weharvest.edu.dao.mapper;

import com.weharvest.edu.dto.BackstageRoleAndMenuAndPermissionDTO;
import com.weharvest.edu.entity.BackstageMenu;
import com.weharvest.edu.entity.BackstageRole;
import com.weharvest.edu.view.BackstagePermissionView;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 角色菜单权限  中间表
 */
@Repository
public interface BackstageRoleAndMenuAndPermissionDaoMapper extends BaseDaoMapper {


    /**
     * 根据角色id查看所有菜单
     *
     * @param backstageRole
     * @return
     */
    List<BackstageMenu> queryByAllBackstageMenu(BackstageRole backstageRole);


    /**
     * 根据该角色id来查询所有拥有菜单下的资源操作
     *
     * @param backstageRole
     * @param menus
     * @return
     */
    List<BackstagePermissionView> queryByBackstagePermissionView
    (@Param("backstageRole") BackstageRole backstageRole, @Param("menus") List<BackstageMenu> menus);


    /**
     * 根据角色id查询所拥有的菜单
     *
     * @param backstageRole
     * @return
     */
    List<BackstageMenu> queryByBackstageMenu(BackstageRole backstageRole);


    /**
     * 授权-删除角色菜单中间表
     *
     * @param roleId
     * @return
     */
    int deleteByBackstageRoleMenu(String roleId);

    /**
     * 授权-删除角色菜单资源中间表
     *
     * @param roleId
     * @return
     */
    int deleteByBackstageRoleMenuPermission(String roleId);


    /**
     * 授权-批量插入-角色菜单中间表
     *
     * @param
     * @return bRMP
     */
    int batchAddByBackstageRoleMenu(BackstageRoleAndMenuAndPermissionDTO bRMP);

    /**
     * 授权-批量插入-角色菜单权限中间表
     *
     * @param bRMP
     * @return
     */
    int batchAddByBackstageRoleMenuPermission(BackstageRoleAndMenuAndPermissionDTO bRMP);


}
